package com.zjj.exception.balance;

public class Test {
    public static void main(String[] args) {
        // 创建一个账户，初始余额为 1000
        ExceptionTest account = new ExceptionTest("123456", 1000);
        double withdrawalAmount = 1500;

        try {
            // 调用取款方法
            account.withdraw(withdrawalAmount);
        } catch (InsufficientBalanceException e) {
            System.out.println("取款失败：" + e.getMessage());
        } catch (IllegalArgumentException e) {
            System.out.println("输入错误：" + e.getMessage());
        } finally {
            // 无论是否发生异常，都显示当前余额
            System.out.println("当前账户余额：" + account.getBalance());
        }
    }
}
